package com.kate.mall.mall.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kate.mall.common.utils.PageUtils;
import com.kate.mall.common.utils.Query;

import com.kate.mall.mall.dao.StorageDao;
import com.kate.mall.mall.entity.StorageEntity;
import com.kate.mall.mall.service.StorageService;


@Service
public class StorageServiceImpl extends ServiceImpl<StorageDao, StorageEntity> implements StorageService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<StorageEntity> page = this.page(
                new Query<StorageEntity>().getPage(params),
                new QueryWrapper<StorageEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public StorageEntity findByKey(String key) {
        return baseMapper.selectOne(new QueryWrapper<StorageEntity>().lambda().eq(StorageEntity::getKey,key));
    }

}